package api

import (
	"beetle/internal/biz"
)

var settingRepo biz.RedisSettingRepo
var recordRepo biz.RedisRecordRepo
var dictRepo biz.DictRepo

func initRepo(app *App) {
	settingRepo = biz.NewRedisSettingRepo(app.DB())
	recordRepo = biz.NewRedisRecordRepo(app.DB())
	dictRepo = biz.NewDictRepo(app.DB())
}

var settingService biz.RedisSettingService
var recordService biz.RedisRecordService
var redisOpService biz.RedisDataOpService
var dictService biz.DictService

func initService(app *App) {
	initRepo(app)
	settingService = biz.NewRedisSettingService(settingRepo)
	recordService = biz.NewRedisRecordService(recordRepo)
	redisOpService = biz.NewRedisOpService(app.DB(), recordRepo, settingRepo)
	dictService = biz.NewDictService(dictRepo)
}
